<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>单文件上传</title>
</head>

<body>
  <div>
    <h1>单个文件上传</h1>
    <input type="file" id="file-uploader">
    <p>上传文件，并在浏览器控制台中查看输出。</p>
    <p id="feedback"></p>
  </div>
</body>
<script>
  const fileUploader = document.getElementById('file-uploader');

  fileUploader.addEventListener('change', (event) => {
    const files = event.target.files;
    console.log('files', files);

    const feedback = document.getElementById('feedback');
    const msg = `File ${files[0].name} uploaded successfully!`;
    feedback.innerHTML = msg;
  });
</script>

</html>